var B;
varexo W;
parameters R, beta;
R = 0.02;
beta = 0.97;

model;
B(+1)=(1+R)*B + W - beta*(1+R)*((1+R)*B(-1)+W-B);
end;

initval;
B = 0;
W = 10;
end;

endval;
B = 0;
end;

perfect_foresight_setup(periods = 100);
perfect_foresight_solver;
rplot B;

epilogue;
c =((1+R)*B + 10 - B(+1))/(beta*(1+R));
end;